<template>
  <div>
    <el-table :data="data" border style="width: 100%">
      <el-table-column
        v-for="(item, i) in options"
        :key="i"
        :prop="item.property"
        :type="item.type"
        :label="item.label"
      >
        <template v-slot="{ row }" v-if="item.slot">
          <slot :name="item.slot" :row="row"></slot>
        </template>
      </el-table-column>
    </el-table>
    <el-pagination
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
      :current-page="current_page"
      :page-sizes="page_sizes"
      :page-size="page_size"
      :layout="layout"
      :total="total"
    >
    </el-pagination>
  </div>
</template>

<script>
export default {
  props: {
    options: {
      type: Array,
      default: () => [],
    },
    data: {
      type: Array,
      default: () => [],
    },
    current_page:{
        type: Number,
        default: 1
    },
    page_sizes:{
        type: Array,
        default: () => [2,4,6,8,10],
    },
    page_size:{
        type: Number,
        default: 1
    },
    layout:{
        type: String,
        default: "total, sizes, prev, pager, next, jumper"
    },
    total:{
        type: Number,
        default: 0
    }
  },
  data() {
    return {};
  },
  computed: {},
  created() {},
  mounted() {},
  watch: {},
  methods: {
    handleSizeChange(val){
        this.$emit('size-change',val)
    },
    handleCurrentChange(val){
        this.$emit('current-change',val)
    }
  },
  components: {},
};
</script>

<style scoped lang="scss">
</style>
